<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<script type="text/javascript" src="js/jquery.js"></script>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/bootstrap-dropdown.js"></script>
	<script type="text/javascript" src="js/bootstrap-modal.js"></script>
	<script type="text/javascript" src="js/bootstrap-transition.js"></script>
	
	<style type="text/css">
		body{
			margin-top:50px;
		}
		.page-header{
			background-color:rgb(240, 245, 248);
		}
		#talk{
			width:570px;
			height:100px;
		}
		
	</style>
	
</head>
<body>
	<div class="navbar navbar-fixed-top">
	  <div class="navbar-inner">
		<div class="container">
			<a class="brand" href="#">
			  <img src="img/user_group.png" alt="" />&nbsp;客户关系管理系统
			</a>
			<ul class="nav">
			  <li class="active">
				<a href="welcome.action">概览</a>
			  </li>
			  <li><a href="contacts.action">通讯录</a></li>
			  <li><a href="tasks.action">任务</a></li>
			  <li><a href="chances.action">机会</a></li>
			  <li><a href="fanhui.action">讨论</a></li>
			  <li class="dropdown" id="menutest1">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest1">
				  添加
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				  <li><a href="new_contact.action"><i class="icon-user"></i>&nbsp;联系人</a></li>
				  <li><a href="new_company.action"><i class="icon-home"></i>&nbsp;公司</a></li>
				  <li class="divider"></li>
				  <li><a href="new_task.action"><i class="icon-ok"></i>&nbsp;任务</a></li>
				  <li><a href="new_chance.action"><i class="icon-star-empty"></i>&nbsp;机会</a></li>
				</ul>
			  </li>
			  
			</ul>
			
			<ul class="nav pull-right" >
			  <li>
				<a href="#">${sessionScope.user.username }</a>
			  </li>
			  <li class="dropdown" id="menutest2">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest2">
				  管理
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
						 <li><a href="manage_user.action?id=${sessionScope.user.id }"><i class="icon-user"></i>&nbsp;同事</a></li>
				  <li><a href="manage_group.action"><i class="icon-list-alt"></i>&nbsp;组</a></li>
				  <li class="divider"></li>
				<!--  <li><a href="user_update_user.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li> -->
				  <li><a href="show_user_msg.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li>
				</ul>
			  </li>
			  <li class="divider-vertical"></li>
			  <li><a href="sign_in.action">退出</a></li>
			</ul>
			
		</div>
	  </div>
	</div>
	
	<div class="container">
		
			<div class="row">
				  <div class="span2"></div>
				  <div class="span8">
					
						<div class="page-header well">
						  <h2><img src="img/news.png" alt="" />${deal.title }</h2><br>
						 <span style="font-size:16px;font-weight:bold"> 内容：${deal.content}</span>
						</div>
						<div class="page-header well">
						  <span  style="font-size:15px;font-family:微软雅黑"><img src="img/talk_weibo.png" alt="" /></span>
							<form action="">
								<div>
									<textarea name="talk" id="talk" cols="5"  rows="5" ></textarea>
								</div>
								<input class="btn btn-primary " type="button" value="发表评论"  id="jk"/>
							</form>	
							<div  id="result">
							  <span style="margin-bottom:-5px;padding-top:-5px;font-size:20px;font-family:微软雅黑"> 评论</span>
					                    <hr style="margin-top:0px;margin-bottom:5px">
					                    
						<!-- 	<div>
							  <span style="font-size:18px">2012-8-23</span>
							 </div> -->
							 <div  id="ress">
							<c:forEach  items="${deal.dealNoteSet }"  var ="v">
							 <div style="font-size:16px;font-family:微软雅黑;margin-bottom:15px;margin-top:2px;"  class="ts" >${v.user.username } :&nbsp;${v. content}</div>
							  ${v.createtime} <a href="javascript:;"   style="padding-left:10px;"  class="huifu">回复</a>
							      <div class="tts">
							     
							      
							      </div>
							      <hr style="margin-top:0px;margin-bottom:0px">
							      <br> 
							      </c:forEach>
							      </div>
							<div id="textre" style="display:none">
							<textarea name="talk" id="talk" cols="3"  rows="3" ></textarea>
							<input type="button" value="确定">
							</div>
							
							</div>
							
						</div>		
						
						
				  </div>
				  <div class="span4" >
						<div class="page-header well"  style="height:600px;width:250px">
						  <h3><img src="img/contact.png" alt="" /><a href="edi.action?id=ba8b8be43914a750013914cd8fd20003">编辑机会</a></h3>
							<table class="table">
							  <tbody>
								<tr>
								  <td>
									 <h3>
						  <span>任务</span>
				
							 <a  href="" style="font-size:14px ;margin-left:110px;color:black">添加任务</a>
				     
						  </h3>
							<div><span>状态 </span> <br>
							 电子邮件 &nbsp；上午九点至八月十日
							
							</div>
								  
								  </td> 
							
							
								</tr>
						
							  </tbody>
							</table>
						</div>	
						<!-- <div class="page-header well">
						  <h3>
						  <span>任务</span>
				
							 <a  href="" style="font-size:14px ;margin-left:110px;color:black">添加任务</a>
				     
						  </h3>
							<div>状态  <br>
							 电子邮件 &nbsp；上午九点至八月十日
							
							</div>
					
				  </div> -->
				</div>
			</div>
	  </div>

		
	<script type="text/javascript">
		$(document).ready(function(){
		$("#jk").click(function(){
		//$("#ress").text("");
	      var t=	$("#talk").val();
           var dealid="${deal.id}";
       //  var ts=  $("<div>").text(t);

       /* var name="${sessionScope.user.username}";
        alert(name)*/
/*          alert(dealid);
         alert(t); */
         
         
         
	$.post("saveNote.action",{textnote:t,dealid:dealid},function(json){
	  
	    $(json).each(function(){
	 
	 var name=this.username;
	 var text=this.content;
	 var time=this.createtime;
     var divtext= $("<div style='margin-left:10px;margin-bottom:6px;font-size:16px;'>").text(name+":"+""+text);
          var a=$("<a href=''>").text("恢复");
          var timediv=$("<div>").text(time).append(a);
          
          
          var hr=$("<hr style='margin-top:0px;margin-bottom:3px;'>");
         /*  $(".tts").append(divtext);  */
            $("#ress").append(divtext); 
             $("#ress").append(timediv);
 
              
       /*    $("#result").append(divtext); 
	      $("#result").append(timediv); 
	      	 //     $("#result").append(a); 
	  	  $("#result").append(hr);  */
	 });
	 
	 }); 
      
	}) ;
	
	
	/* $(".huifu").click(function(){
	   $("#textre").css("display","block");
	
	}) */
	
		
		});

	</script>
</body>
</html>